home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: December 10, 1999
- // Author: DNP
- //
- // Description:
- // addRecentProject, used currently used by Project Viewer.
- // adds projects to the recent project list.
- //
-
-
-
- global proc addRecentProject( string $theProject )
- {
- string $RecentProjectsList[];
- int $i;
- int $nNum;
- int $maxNum;
-
- string $project = $theProject;
- // Strip off slash from the end if it's there (and not the only char)
- if ( size( $theProject ) > 1 &&
- (gmatch($theProject, "*/") || gmatch($theProject, "*\\\\")) )
- {
- $project = substitute( "/$", $theProject, "" );
- }
-
- $maxNum = `optionVar -q "RecentProjectsMaxSize"`;
-
- if (!`optionVar -exists "RecentProjectsList"`)
- {
- if ( $maxNum > 0 )
- optionVar -sva "RecentProjectsList" $project;
- return;
- }
-
- // get the list
- $RecentProjectsList = `optionVar -q "RecentProjectsList"`;
- $nNum = size($RecentProjectsList);
-
- // search for name in the list.
- for ($i = 0; $i < $nNum; $i++)
- {
- if ($RecentProjectsList[$i] == $project)
- {
- // move it to the top.
- optionVar -rfa "RecentProjectsList" $i;
- optionVar -sva "RecentProjectsList" $project;
- return;
- }
- }
-
- // not found, append at the end.
- optionVar -sva "RecentProjectsList" $project;
- $nNum = `optionVar -arraySize "RecentProjectsList"`;
- if ( $nNum > $maxNum ) // default maximum size
- {
- for ( $i = 0; $i < $nNum - $maxNum; $i++ )
- {
- // remove the oldest one.
- optionVar -rfa "RecentProjectsList" 0;
- }
- }
- }
-